﻿using CardPlay.Model.CardModel;
using CardPlay.Model.Primitives;
using TechTalk.SpecFlow;

namespace CardPlay.Tests.Common
{
    [Binding]
    public class ArgumentTransformation
    {
        [StepArgumentTransformation(@"(\w+ of \w+)")]
        public CardFace ToCardFace(string expression)
        {
            return CardFace.Parse(expression);
        }

        [StepArgumentTransformation(@"(accept|reject)(?:ed)")]
        public bool ToBool(string expression)
        {
            return expression == "accept";
        }

        [StepArgumentTransformation(@"(.+)")]
        public CardFaceSequenceSpecification ToCardFaceSequenceSpecification(string rule)
        {
            return typeof(CardFaceSequence).GetStaticField<CardFaceSequenceSpecification>(rule.ToMemberName());
        }
    }
}